home *** CD-ROM | disk | FTP | other *** search
/ C# & Game Programming - A…er's Guide (2nd Edition) / Buono 2nd Ed.iso / Chapter1 / 1.29 / 1.29.cs next >
Text File  |  2004-09-01  |  659b  |  21 lines

  1. /* Integer subtraction. */
  2. using System;
  3.  
  4. namespace Chapter1 {
  5.     class Class1 {
  6.         static void Main() {
  7.             int number1, number2, total;   
  8.             number1 = 5;
  9.             number2 = 2;          
  10.             total = number1 - number2;  /* 5 - 2 */  
  11.             
  12.             Console.WriteLine(" {0,3}\n-{1,3}\n ---\n {2,3}", 
  13.                 number1, number2, total);   
  14.             Console.WriteLine("\n {0,3:D}\n-{1,3:D}\n ---\n {2,3:D}", 
  15.                 number1, number2, total);   
  16.             Console.WriteLine("\n {0,3:X}\n-{1,3:X}\n ---\n {2,3:X}", 
  17.                 number1, number2, total);
  18.         } 
  19.     } 
  20. }
  21.